import { _decorator, Acceleration, Component, instantiate, Node } from 'cc';
import { EntityManager } from '../../Base/EntityManager';
import { EntityTypeEnum, IActor } from '../../Common';
import { WeaponStateMachine } from './WeaponStateMachine';
import { EntityStateEnum } from '../../Enum';
import DataManager from '../../Global/DataManager';

const { ccclass, property } = _decorator;
//武器管理类
@ccclass('WeaponManager')
export class WeaponManager extends EntityManager {
    //获取武器的body
    private body: Node
    private anchor: Node
    private point: Node
    init(data: IActor) {
        //设置武器body
        this.body = this.node.getChildByName("Body")
        this.anchor = this.body.getChildByName("Anchor")
        this.point = this.anchor.getChildByName("Point")
        //设置武器状态机
        this.fsm = this.body.addComponent(WeaponStateMachine)
        this.fsm.init(data.weaponType)
        //播放待机动画
        this.state = EntityStateEnum.Idle
        
    }

}